#—*—coding:utf-8 -*-
#@Time        :2022/7/16 17:24
#@Author      :dhx
#@File        :station_add_gonggao.py
# @Software: PyCharm
from time import sleep

from selenium.webdriver.common.by import By
from pages.base_pageage import BasePage

class AddNotice(BasePage):
    url='http://192.168.3.133/crm/index.php?m=announcement&a=add'

    title_locator = (By.XPATH, '/html/body/div[5]/div[2]/div/form/table/tbody/tr[2]/td[2]/input')
    baocun_locator = (By.CSS_SELECTOR, 'body > div.container > div.row > div '
                                       '> form > table > tfoot > tr > td > input.btn.btn-primary')
    desc_locator = (By.XPATH, '/html/body')  # 描述
    def input_topic(self):
        """输入主题"""
        self.driver.find_element(*self.title_locator).send_keys("主题")
        sleep(1)

    def desc_gonggao(self):
            """输入描述"""
            self.driver.switch_to.frame(0)
            self.driver.find_element(*self.desc_locator).send_keys("描述")
            sleep(2)

    def save_topic(self):
            """保存"""
            self.driver.switch_to.default_content()
            self.driver.find_element(*self.baocun_locator).click()
            sleep(1)
